/*
 * @Description: 基础异常类
 * @Author: Haor
 * @Date: 2022-05-07 17:35:00
 * @LastEditTime: 2022-05-07 17:39:44
 * @LastEditors: Haor
 */
import { HttpException } from '@nestjs/common'
/**
 * 定义基础异常类
 * @export
 * @class BaseException
 * @extends {HttpException}
 */
export class BaseException extends HttpException {
	/**
	 *
	 * @param {number} exceptionCode 自定义异常编号
	 * @param {string} errorMessage  提示信息
	 * @param {number} statusCode 状态码
	 * @memberof BaseException
	 */
	constructor(public exceptionCode: number, public errorMessage: string, public statusCode: number) {
		super({ exceptionCode: exceptionCode, errorMessage: errorMessage }, statusCode)
	}

	/**
	 * 获取异常状态码
	 * @returns
	 */
	getExceptionCode(): number {
		return this.exceptionCode
	}

	/**
	 * 获取异常信息
	 * @return {String}
	 */
	getMessage(): string {
		return this.errorMessage
	}

	/**
	 * 获取异常状态码
	 * @return {Number}
	 */
	getStatusCode(): number {
		return this.statusCode
	}
}
